package com.xlh.adapter;

import java.util.List;

import com.xlh.bean.GameServerBean;
import com.xlh.outside.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
 
/**
 * 自定义适配器类
 * =
 *
 */
public class GameServerSelectAdapter extends BaseAdapter {
    private List<GameServerBean> mList;
    private Context mContext;
 
    public GameServerSelectAdapter(Context pContext, List<GameServerBean> pList) {
        this.mContext = pContext;
        this.mList = pList;
    }
 
    @Override
    public int getCount() {
        return mList.size();
    }
 
    @Override
    public Object getItem(int position) {
        return mList.get(position);
    }
 
    @Override
    public long getItemId(int position) {
        return position;
    }
    /**
     * 下面是重要代码
     */
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        LayoutInflater _LayoutInflater=LayoutInflater.from(mContext);
        convertView=_LayoutInflater.inflate(R.layout.svrlist_item, null);
        if(convertView!=null) {
         
            TextView _TextView1=(TextView)convertView.findViewById(R.id.txt_server_name);
          
            _TextView1.setText(mList.get(position).getName());
         //   _TextView2.setText(mList.get(position).getPersonAddress());
        }
        return convertView;
    }
}